package com.handinglian.ai.common.util;

import com.handinglian.ai.common.dto.Attributes;
import io.netty.channel.Channel;

public class ChannelUtil {
    public static void setLogin(String loginStr, Channel channel) {
        channel.attr(Attributes.LOGIN).set(loginStr);
    }

    public static boolean hasLogin(Channel channel) {
        return channel.hasAttr(Attributes.LOGIN);
    }

    public static String getLogin(Channel channel) {
        return channel.attr(Attributes.LOGIN).get();
    }

    public static boolean hasSessionId(Channel channel) {
        return channel.hasAttr(Attributes.SESSION_ID);
    }

    public static void setSeesionId(String sessionId, Channel channel) {
        channel.attr(Attributes.SESSION_ID).set(sessionId);
    }

    public static String getSessionId(Channel channel) {
        return channel.attr(Attributes.SESSION_ID).get();
    }

    public static void setCallId(String CallId, Channel channel) {
        channel.attr(Attributes.CALL_ID).set(CallId);
    }

    public static String getCallId(Channel channel) {
        return channel.attr(Attributes.CALL_ID).get();
    }

    public static void setCount(Integer count, Channel channel) {
        channel.attr(Attributes.COUNT).set(count);
    }

    public static Integer getCount(Channel channel) {
        return channel.attr(Attributes.COUNT).get();
    }
}
